%% Time series report
%  First draft of automated reporting
%  for commitees of Closest Ranked Neighbor 
%  predictors applied to time series
%% Summary of t series prediction
%  Let me know what else would you like 
%  to have in the summary plot.
load dy_ %load the trained commitees
close all;neighbor_predict_plot(dy,'survival');
%%  Cluster analysis of all variables
%  This is for exploratory purposes only. Each panel uses a small fraction
%  of the variables available and even then the prediction relies of a
%  subset of variables used by all panels of the same commitee.
%  The spheres on the patient dendrogram distinguis "dead" (black) from
%  "non-dead" (white, unknown status included here) which again is not very
%  informative as those patients that have been followed for the longets
%  time are the most likely to having been found not to be alive.
dt=dy;dt.y=~dy.dead;close all;
neighbor_predict_plot(dt,'clusterall');set(gcf,'Color','w');
%% Individual predictors
%  For each point where a survival ended, 
%  a new predictor was independently trained.
%  Let me knwo what else besides the recruitment 
%  scheme would you like to see. I am developing
%  code to add Response Operatic Characteristic
%  (ROC) curves to assess teh balance between false
%  positive and false negative predictions.
close all;
for i=1:length(dy.predict)
    dt=dy;
    dt.predict=dy.predict(i);
    dt.y(dt.predict.exclude)=[];
    dt.nx(dt.predict.exclude,:)=[];
    dt.y=dt.y>dt.predict.T;
    if sum(dt.y==1)>0
        figure;neighbor_predict_plot(dt,'recruit');
    end
end
%% Discussion
%  ... ooops time to board the flight ... more later
